﻿#region usingregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using game_for_test_helper.src.font;
using NUnit.Framework;
using Microsoft.Xna.Framework;
#endregion

namespace game_for_test_helper.src.util
{
    //[TestFixture]
    public static class TextureFonts
    {
        private static Dictionary<char,Rectangle> dict=new Dictionary<char,Rectangle>();
        static TextureFonts()
        {
            if (dict == null || dict.Count == 0)
                LoadFont();
        }
        public static Rectangle getRectangle(char ch)
        {
            return dict[ch];
        }
        //[TestCase]
        public static void LoadFont()
        {
            List<LetterOfImage> list;
            list = (List<LetterOfImage>)SerializeUtil.DeSerilizeAnFileToObject("./configure/DayDream.xml", typeof(List<LetterOfImage>));
            foreach (LetterOfImage letter in list)
            {
                dict.Add(Convert.ToChar(letter.Assic), new Rectangle(letter.LeftTop.X, letter.LeftTop.Y, letter.Width, letter.Height));
            }
            Rectangle rect=dict['A'];
            //System.Console.WriteLine(rect);
        }
    }
}
